x = [0,1]
fib = 0
n = 0
while(n <= 4000000):
	n = x[0]+x[1]
	if(n % 2 == 0):
		fib = fib+n
	x[0] = x[1]
	x[1] = n

print(fib)